package com.example.concurrentprogramming8016.future.completablefuture;

import java.util.concurrent.CompletableFuture;

/**
 * @author liyanhao
 * @Date 2023-01-08 20:33
 */
public class

ThenAcceptDemo {
    public static void main(String[] args) {
        CompletableFuture<Void> completableFuture = CompletableFuture.supplyAsync(() -> {
            int number = (int) (Math.random() * 100);
            System.out.println("第一阶段 " + number);
            return number;
        }).thenAccept(number -> {
            System.out.println("第二阶段 " + number);
        });
        //thenAccept没有返回值
//        Void unused = completableFuture.get();

    }
}
